<template>
  <box3 title="釜运行状态" class="box3-fu">
    <div class="__content">
      <div v-for="(item, index) in fuData" :key="item.code" class="c2c-item">
        <div class="item-num">{{ index + 1 }}#</div>
      
        <a-popover :getPopupContainer="getPopupContainer" :arrow="false" overlayClassName="board-popover" :title="`${item.deviceName}${item.name ? '（':''}${item.name || ''}${item.name ? '）':''}`" placement="topRight">
          <template #content>
            <div class="board__nums">
              <div class="__nums-item">
                <div>{{item.targetedValues[0].value}}&nbsp;{{item.targetedValues[0].unitName}}</div>
                <div><span class="iconfont icon-weight"></span></div>
              </div>
              <div class="__nums-item">
                <div>{{item.targetedValues[1]?.value}}&nbsp;{{item.targetedValues[1]?.unitName}}</div>
                <div><span class="iconfont icon-yaqiang"></span></div>

              </div>
              <div class="__nums-item">
                <div>{{item.targetedValues[2]?.value}}&nbsp;{{item.targetedValues[2]?.unitName}}</div>
                <div><span class="iconfont icon-wenduji"></span></div>

              </div>
              <div class="__nums-item">
                <div>{{item.targetedValues[3]?.value}}&nbsp;{{item.targetedValues[3]?.unitName}}</div>
                <div><span class="iconfont icon-shijianxuliepinshuaizhuanhuan-xuanzhong"></span></div>

              </div>
            </div>
          </template>
          <div :class="`item-icon`">
          <div class="item-icon-inner" :style="{
            backgroundColor: item.color
          }">
            <span :class="`iconfont icon-a-shanyeshixin ${item.deviceStatus ==='stop' ? '' : '__ani'}`"></span>
          </div>
          </div>
        </a-popover>

      </div>
    </div>
  </box3>
</template>

<script setup lang="ts">
import { defineProps } from 'vue';
import useData from '../useData';
import Run from './run.vue';
import box3 from '../../compNew/box3.vue';

const getPopupContainer = () => {
  return document.querySelector('.box3-fu');
}
const props = defineProps<{
  isComp: boolean
}>()
const { fuData } = useData('fu', props.isComp);

</script>

<style lang="scss" scoped>
  @keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
.__content {
  display: grid;
  grid-gap: 1.5vh;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  height: 100%;
  padding: 1vh 3vh 1vh 3vh;
  @media screen and (max-width: 800px) {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
  .c2c-item {
    // padding: 10px 20px 0;
    position: relative;
    .item-name{
      position: absolute;
      bottom: -2vh;
      color: #fff;
      left: 0;
      overflow: hidden;
      font-size: 1.4vh;
      height: 1.4vh;
      line-height: 1.4vh;
      width: 100%;
      text-align: center;
    }
    .item-num {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 2vh;
      height: 2vh;
      font-size: 1.2vh;
      border-radius: 100%;
      background: #03d9eb;
      color: #333;
      position: absolute;
      left: 0.5vh;
      top: 0;
     
    }

    .item-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 8vh;
      height: 8vh;
      margin: 0 0 0 3vh;
      position: relative;
      background: url('./fu.png') no-repeat;
      background-size: auto 100%;
      background-position: center;
      .item-icon-inner{
        width: 4vh;
        height: 4vh;
        border-radius: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #75747483;
      }
      .iconfont {
        
        font-size: 2.5vh;
        color: #ffffff;
        &.__ani{
          animation: rotate 2s infinite linear;
        }
      }
    }
  }
}
</style>
